package com.iefgames.cs.framework.exception;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.iefgames.cs.manager.CometManager;
import com.iefgames.cs.manager.CsManager;
import com.iefgames.cs.manager.UsManager;

public class CometDisconnectException extends RuntimeException{
	private static Log logger = LogFactory.getLog(CometDisconnectException.class);
	
	public CometDisconnectException(HttpServletRequest request,
			HttpServletResponse response, Throwable throwable) {
		String uuid = request.getParameter("uuid");
		CometManager.remove(uuid);		//移除comet
		if (request.getAttribute("sessionId") != null) {
			CsManager.remove(uuid);			//is cs
		} else {
			UsManager.remove(uuid);			//is us
		}
		
		logger.warn(throwable);
	}
}
